package com.cjm.one.goods.client;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cjm.one.common.constant.ServerConstants;
import com.cjm.one.common.result.Result;
import com.cjm.one.model.goods.entity.GoodsCategory;
import com.cjm.one.model.goods.vo.GoodsCategoryVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(value = ServerConstants.SERVER_ONE_GOODS)
public interface GoodsCategoryClient {
    @GetMapping("/admin/goods/category/list")
    @Operation(summary = "商品分类列表")
    Result<List<GoodsCategoryVo>> getPage(@RequestParam(name = "searchKey",required = false) String searchKey);
    @GetMapping("/admin/goods/category/{id}")
    @Operation(summary = "商品分类详情")
    Result<GoodsCategoryVo> getById(@PathVariable("id") Long id);

    @PutMapping("/admin/goods/category")
    @Operation(summary = "商品分类修改")
    Result<Boolean> update(@RequestBody GoodsCategory goodsCategory);
    @PostMapping("/admin/goods/category")
    @Operation(summary = "商品分类添加")
    Result<Boolean> save(@RequestBody GoodsCategory goodsCategory);
    @DeleteMapping("/admin/goods/category/{id}")
    @Operation(summary = "商品分类删除")
    Result<Boolean> delete(@PathVariable("id") Long id);
    @GetMapping("/admin/goods/category/ToParentId")
    @Operation(summary = "商品分类树")
    public Result<List<GoodsCategory>> getToParentId(@RequestParam(name = "parentId",required = true) Long parentId);

    @GetMapping("/app/goods/category/listLimit10")
    @Operation(summary = "首页获取商品分类列表")
    Result<List<GoodsCategory>> listLimit10(@RequestParam(name = "size",required = false) Integer size);
    @GetMapping("/app/goods/category/byParentId")
    @Operation(summary = "根据父id获取商品分类列表")
    Result<List<GoodsCategory>> selectToParentId(@RequestParam(name="parentId",required = false) Long parentId);
}
